<?php slot('lender','active'); ?>
<div class="row-fluid">
				<div class="box span12">
					<div class="box-header">
						<h2><i class="icon-edit"></i>发布借款</h2>
						<div class="box-icon"></div>
					</div>
					<div class="box-content">
              <?php if($sf_user->hasFlash('error')): ?>
              <div class="alert alert-error">
                      <button type="button" class="close" data-dismiss="alert">×</button>
                      <strong>错误！</strong>  <?php echo $sf_user->getFlash('error'); ?>
              </div>
              <?php endif; ?>
              <?php if($sf_user->hasFlash('success')): ?>
              <div class="alert alert-success">
                      <button type="button" class="close" data-dismiss="alert">×</button>
                      <strong>操作成功！</strong> <?php echo $sf_user->getFlash('success'); ?>
              </div>
              <?php endif; ?>
                                          
						<form class="form-horizontal" action="<?php echo url_for('lender/create'); ?>" method="post">
						  <fieldset>
							<div class="control-group ">
								<label class="control-label" for="focusedInput">用户名</label>
								<div class="controls">
								  <input class="input-xlarge focused" id="user_name" type="text" value="" />
                                  <input id="user_id" type="hidden" value="0" name="user_id" />
                                  <input id="user_quota" type="hidden" value="0" name="user_quota" />
                                   <span class="help-inline"></span>
                                  <button type="button" class="btn btn-success btn-next" id="find_user_info">查找 <i class="icon-user"></i></button>
								</div>
							  </div>
                               <div class="control-group">
								<label class="control-label">用户限额</label>
								<div class="controls">
								  <span class="input-xlarge uneditable-input" id="user_limit_money">0.00</span>
                                  <span class="help-inline">
                                    <a href="" id="show_user_info" target="_blank" style="display:none;">查看资料</a>
                                  </span>
								</div>
							  </div>
                            
                              <div class="control-group">
								<label class="control-label" for="selectError3">借款用途</label>
								<div class="controls">
								  <select id="selectError3" name="purpose">
                                    <?php foreach($loan_purposes as $purpose): ?>
									<option value="<?php echo $purpose->getId(); ?>"><?php echo $purpose->getName(); ?></option>
                                    <?php endforeach; ?>
                                  </select>
								</div>
							  </div>
                            
                            <div class="control-group">
								<label class="control-label" for="selectError3">列表类型</label>
								<div class="controls">
								  <select id="selectError3" name="list_type">
									<?php foreach($loan_list_types as $type): ?>
									<option value="<?php echo $type->getId(); ?>"><?php echo $type->getName(); ?></option>
                                    <?php endforeach; ?>
                                  </select>
								</div>
							  </div>
                            <div class="control-group">
								<label class="control-label" for="focusedInput">借款标题</label>
								<div class="controls">
								  <input class="input-xlarge focused" id="focusedInput" type="text" name="title" value="">
								</div>
							  </div>
                              
                             <div class="control-group">
								<label class="control-label" for="focusedInput">借款金额</label>
								<div class="controls">
								  <input class="input-xlarge focused" id="focusedInput" type="text" name="money" value="0.00">
                                  <span class="help-inline">元</span>
								</div>
							  </div>
                            
                             <div class="control-group">
								<label class="control-label">借款期限类型</label>
								<div class="controls">
								  <label class="radio">
									<input type="radio" name="is_day" id="month_click" value="0" checked="" />
									月标
								  </label>
								  <div style="clear:both"></div>
								  <label class="radio">
									<input type="radio" name="is_day" id="day_click" value="1" />
									天标
								  </label>
								</div>
							  </div>
                            
                            <div class="control-group ">
								<label class="control-label" for="focusedInput">借款期限</label>
								<div class="controls">
								  <input class="focused" name="term_num" type="text" value="1" />
                                   <span class="help-inline" id="term_type">月</span>
								</div>
							  </div>
                            
                             <div class="control-group ">
								<label class="control-label" for="focusedInput">利率</label>
								<div class="controls">
								  <input class="focused" name="money_rate" type="text" value="" />
                                   <span class="help-inline">%</span>
								</div>
							  </div>
                            
                            <div class="control-group ">
								<label class="control-label" for="focusedInput">截止日期</label>
								<div class="controls">
								  <input class="focused" name="end_time" type="text" value="" />
                                   <span class="help-inline">天</span>
								</div>
							  </div>
                            
                            <div class="control-group ">
								<label class="control-label" for="focusedInput">平台服务费</label>
								<div class="controls">
								  <input class="focused" name="service_fee" type="text" value="" />
                                   <span class="help-inline"></span>
								</div>
							  </div>
                            
                            <div class="control-group">
								<label class="control-label">是否提现</label>
								<div class="controls">
								  <label class="radio">
									<input type="radio" name="cash" id="month_click" value="0" checked="" />
									否
								  </label>
								  <div style="clear:both"></div>
								  <label class="radio">
									<input type="radio" name="cash" id="day_click" value="1" />
									是
								  </label>
								</div>
							  </div>
                            <div class="control-group ">
								<label class="control-label" for="focusedInput">小区名称</label>
								<div class="controls">
								  <input class="focused" name="estate_name" type="text" value="" />
                                   <span class="help-inline"></span>
								</div>
							  </div>
                              
                              <div class="control-group ">
								<label class="control-label" for="focusedInput">使用面积</label>
								<div class="controls">
								  <input class="focused" name="build_size" type="text" value="" />
                                   <span class="help-inline"></span>
								</div>
							  </div>
                              <div class="control-group ">
								<label class="control-label" for="focusedInput">使用年限</label>
								<div class="controls">
								  <input class="focused" name="use_year" type="text" value="70" />
                                   <span class="help-inline"></span>
								</div>
							  </div>
                              <div class="control-group ">
								<label class="control-label" for="focusedInput">评估价格</label>
								<div class="controls">
								  <input class="focused" name="evaluate_price" type="text" value="0.00" />
                                   <span class="help-inline"></span>
								</div>
							  </div>
                              
                              <div class="control-group ">
								<label class="control-label" for="focusedInput">参考价格</label>
								<div class="controls">
								  <input class="focused" name="reference_price" type="text" value="0.00" />
                                   <span class="help-inline"></span>
								</div>
							  </div>
                            <div class="control-group hidden-phone">
							  <label class="control-label" for="textarea2">额度信息</label>
							  <div class="controls">
								<textarea id="edu" name="quota_info"></textarea>
							  </div>
							</div>
                            
                            <div class="control-group hidden-phone">
							  <label class="control-label" for="textarea2">借款详情</label>
							  <div class="controls">
								<textarea id="jiekuan_info" name="loan_info"></textarea>
							  </div>
							</div>
                            
                            <div class="control-group hidden-phone">
							  <label class="control-label" for="textarea2">风险控制</label>
							  <div class="controls">
								<textarea id="fengxian" name="risk_management_info"></textarea>
							  </div>
							</div>
							<div class="form-actions">
							  <input type="submit" class="btn btn-primary" value="保存数据" />
							  <button type="reset" class="btn" onclick="window.location.href='<?php echo url_for('lender/index'); ?>';">返回列表</button>
							</div>
						  </fieldset>
						</form>
					</div>
				</div><!--/span-->

			</div>
<script type="text/javascript">
$(document).ready(function(){
  
  $("#day_click").click(function(){
    $("#term_type").text("天");
  });
  
  $("#month_click").click(function(){
    $("#term_type").text("月");
  });
  
  $("#find_user_info").click(function(){

     var user_name = $("#user_name").val();
     
     $.post('<?php echo url_for('user/find_user_info'); ?>',{'user_name':user_name},function(msg){
        var status = msg.status;
        
        if(status == 0){
          alert('用户不存在或账户信息错误，请检查！');
          return false;
        }
        
        var user_id = msg.info.user_id;
        var money = msg.info.user_limit_money;
        var show_user_link = '<?php echo url_for('user/show_user_info?id=')?>'+user_id;
        $("#user_id").val(user_id);
        $("#user_limit_money").text(money);
        $("#user_quota").val(money);
        $("#show_user_info").attr('href',show_user_link).show();
        
     },'json');
     
  });
  
});
                var kindedit_options = {
                    'allowFileUpload':true,
                    'width':600,
                    'height':400,
                    'allowFileManager':false,
                    'allowImageUpload':false,
                    'allowMediaUpload':false,
                    'allowFlashUpload':false,
                    'filterMode' : false,
                    'shadowMode':true,
                    'items':  [ 
                                'source', '|', 'undo', 'redo', '|', 'preview',  'about','template', 'code', 'cut', 'copy', 'paste',
                                'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                                'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                                'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                                'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
                                'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
                                'anchor', 'link', 'unlink'
                            ],
                    'uploadJson' : '<?php // echo url_for('file/upload') ?>',
                    'fileManagerJson' : '<?php // echo url_for('file/manage') ?>'
                     
                };
                
     var editer = KindEditor.create($('#edu,#fengxian,#jiekuan_info'),kindedit_options);


</script>